﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharp_1209
{
    public interface ITerrestrialAnimal
    {
        string Eat();
    }

    public interface IMarineAnimal
    {
        string Eat();
        string Swim();
    }

    public class Crocodile : ITerrestrialAnimal, IMarineAnimal
    {
        // Explicit implement
        string ITerrestrialAnimal.Eat()
        {
            return "Crocodile eats other animal";
        }

        public string Swim()
        {
            return "Crocodile is swimming";
        }

        string IMarineAnimal.Eat()
        {
            return "Crocodile eats fish and marine animals";
        }

        public string EatTerrestrial()
        {
            ITerrestrialAnimal objTerAnimal = this;
            return objTerAnimal.Eat();
        }

        public string EatMarine()
        {
            IMarineAnimal objMarAnimal = this;
            return objMarAnimal.Eat();
        }

        public static void Test()
        {
            Crocodile objCrocodile = new Crocodile();
            
            ITerrestrialAnimal ita = objCrocodile;
            IMarineAnimal ima = objCrocodile;

            string terCroc = objCrocodile.EatTerrestrial();
            Console.WriteLine(terCroc);
            
            string marCroc = objCrocodile.EatMarine();
            Console.WriteLine(marCroc);
        }
    }
}
